// JavaScript Document
$(document).ready(function() {
	$('textarea.tinymcefull').tinymce({
		// Location of TinyMCE script
		script_url : _baseurl+'jscripts/tiny_mce/tiny_mce.js',
		// General options
		language : "vi",
		document_base_url : 'http://tinymce.moxiecode.com',
		relative_urls : true,
		theme : "advanced",
		skin : "o2k7",
		plugins : "safari,pagebreak,style,layer,table,advhr,advlink,emotions,iespell,inlinepopups,preview,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,forecolor,backcolor,image,|,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,|,undo,redo,|,link,unlink,|,hr,removeformat,cleanup",
		theme_advanced_buttons2 : "formatselect,fontselect,fontsizeselect,|,sub,sup,|,charmap,|,fullscreen,|,pastetext,pasteword,|,replace,code",
		//theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "",
		//theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,advhr,|,fullscreen",
		//theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		file_browser_callback: 'openKCFinder'
	});
	
	$('textarea.tinymcesimple').tinymce({
		// Location of TinyMCE script
		script_url : _baseurl+'jscripts/tiny_mce/tiny_mce.js',
		// General options
		language : "vi",
		document_base_url : 'http://tinymce.moxiecode.com',
		relative_urls : true,
		theme : "advanced",
		skin : "o2k7",
		plugins : "paste",
		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,undo,redo,|,cleanup,|,bullist,numlist,|,pastetext,pasteword,|,code",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		file_browser_callback: 'openKCFinder'
	});
});
function openKCFinder(field_name, url, type, win) {
	//alert(url); alert(type); alert(win);
	tinyMCE.activeEditor.windowManager.open({
		file: _baseurl+'jscripts/kcfinder/browse.php?opener=tinymce&lang=vi&amp;type=anh',
		title: 'KCFinder',
		width: 700,
		height: 500,
		resizable: "yes",
		inline: true,
		close_previous: "no",
		popup_css: false
	}, {
		window: win,
		input: field_name
	});
	return false;
}